package com.lion.seaman.orm.service;


import org.springframework.data.domain.Page;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Direction;

import java.io.Serializable;
import java.util.Collection;
import java.util.List;
import java.util.Map;

public interface BaseService<T, ID extends Serializable> {
    T getEntity();

    T saveOrUpdate(T entity);

    void delete(T entity);

    void delete(ID id);

    void delete(Iterable<T> entites);

    void deleteInBatch(Iterable<T> entites);

    void deleteByIdIn(Collection<ID> idList);

    void deleteByIdString(String idString, String split);

    boolean exists(ID id);

    T getById(ID id);

    Page<T> findPaging(int pageNumber, int pageSize, Map<String, Object> searchParams, Direction direction, List<String> properties);

    Page<T> findPaging(int pageNumber, int pageSize, Map<String, Object> searchParams, Direction direction, String... properties);

    List<T> findAll();

    List<T> findAll(Map<String, Object> searchParams);

    List<T> findAll(Map<String, Object> searchParams, Sort sort);

    List<T> findByProperty(String property, Object value);

    List<T> findByProperty(String property, Object value, Sort sort);
}